package com.weixin.paleituo.activity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.TextView;

import com.weixin.paleituo.R;
import com.weixin.paleituo.application.AbsSuperApplication;
import com.weixin.paleituo.application.BaseApplication;
import com.weixin.paleituo.eventbus.ExitLoginSuccess;

import org.greenrobot.eventbus.EventBus;

public class OtherLoginDialogActivity extends AppCompatActivity {

    private TextView mTvContent;
    private TextView mTvExit;
    private TextView mTvReLogin;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EventBus.getDefault().post(new ExitLoginSuccess());
        BaseApplication.isLoginSuccess=false;
        setContentView(R.layout.activity_other_login_dialog);
        mTvContent = findViewById(R.id.tv_content_actvity_other_login_dialog);

        mTvExit = findViewById(R.id.tv_exit_actvity_other_login_dialog);
        mTvReLogin = findViewById(R.id.tv_relogin_actvity_other_login_dialog);

        mTvContent.setText("您的帐号于另一个地点登录。如非本人操作,则密码可能已泄漏,建议修改密码。");
        mTvExit.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

               /* android.os.Process.killProcess(android.os.Process.myPid());
                System.exit(0);*/
                AbsSuperApplication.finishAllActivity();

            }
        });
        mTvReLogin.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                LoginActivity.startActivity(OtherLoginDialogActivity.this,true);
                finish();
            }
        });

    }



    public static void myStartActivity(Context context){
        Intent intent=new Intent(context,OtherLoginDialogActivity.class);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        context.startActivity(intent);
    }

    @Override
    public void onBackPressed() {
       // super.onBackPressed();
    }

}
